﻿using M.Warehouse.API.Application.Command.BinLocationsCommand;
using M.Warehouse.Domain;
using M.Warehouse.Repository.WarehouseInterface;
using MediatR;

namespace M.Warehouse.API.Application.CommandHandlers.BinLocationsCommandHandlers
{
    /// <summary>
    /// 显示仓库
    /// </summary>
    public class WareShowCommandHandler : IRequestHandler<WareShowCommand, List<Warehouses>>
    {
        /// <summary>
        /// 仓库仓储接口
        /// </summary>
        private readonly IWarehouseWRepository _warehouseWRepository;
        /// <summary>
        /// 构造函数注入
        /// </summary>
        /// <param name="warehouseWRepository"></param>
        public WareShowCommandHandler(IWarehouseWRepository warehouseWRepository)
        {
            _warehouseWRepository = warehouseWRepository;
        }
        public async Task<List<Warehouses>> Handle(WareShowCommand request, CancellationToken cancellationToken)
        {
            return await _warehouseWRepository.GetAllAsync();
        }
    }
}
